<template>
  <a-drawer width="800" :title="formTitle" :label-col="4" :wrapper-col="14" :visible="open" :body-style="{ height: 'calc(100vh - 100px)', overflow: 'auto' }" @close="cancel">
    <a-form-model ref="form" :model="form" :rules="rules" layout="vertical">
      <a-spin :spinning="spinning" :delay="delayTime" tip="Loading...">
        <a-row :gutter="32">
          <a-col :span="24">
            <t-x-map :height="mapHeight" v-model="form" :ipFlag="false"></t-x-map>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="名称" prop="name">
              <a-input v-model="form.name" placeholder="请输入区域地图名称" />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="地区" prop="regionId">
              <select-region v-model="form.regionId" :disabled="selectDisable" placeholder="请选择地区" dataType="map" />
            </a-form-model-item>
          </a-col>
          <a-col :span="4">
            <a-form-model-item label="纬度" prop="longitude">
              <a-input v-model="form.longitude" :disabled="inputDisable" placeholder="请输入区域地图纬度" />
            </a-form-model-item>
          </a-col>
          <a-col :span="4">
            <a-form-model-item label="经度" prop="latitude">
              <a-input v-model="form.latitude" :disabled="inputDisable" placeholder="请输入区域地图经度" />
            </a-form-model-item>
          </a-col>
          <a-col :span="4">
            <a-form-model-item label="范围半径" prop="range">
              <a-input-number v-model="form.range" :min="0" :max="3000000" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="4">
            <a-form-model-item label="缩放等级" prop="scale">
              <a-input-number v-model="form.scale" :min="3" :max="20" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="4">
            <a-form-model-item label="纵向偏移量" prop="longitudinalOffset">
              <a-input-number v-model="form.longitudinalOffset" :min="0" :max="1000" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="4">
            <a-form-model-item label="横向偏移量" prop="lateralOffset">
              <a-input-number v-model="form.lateralOffset" :min="0" :max="1000" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="4">
            <a-form-model-item label="文本边缘留白" prop="padding">
              <a-input-number v-model="form.padding" :min="0" :max="100" style="width: 100%" />
            </a-form-model-item>
          </a-col>
        </a-row>
      </a-spin>
      <div class="bottom-control">
        <a-space>
          <a-button :disabled="disabled" @click="cancel"> 取消 </a-button>
          <a-button type="primary" :disabled="disabled" @click="submitForm(true)"> 保存 </a-button>
        </a-space>
      </div>
    </a-form-model>
  </a-drawer>
</template>
<script>
import RegionMapEditForm from './RegionMapForm'
export default {
  ...RegionMapEditForm
}
</script>
